package org.go.work;

import java.io.Serializable;

import org.go.DisallowConcurrentExecution;
import org.go.Go;
import org.go.util.ClassUtils;

/**
 * 
 * @author hejie
 *
 */
public class Work implements Serializable {
	/* */
	private static final long serialVersionUID = -2637505276612158847L;
	private String description;
	private Go go;
	private String workerId;
	private WorkKey workKey;

	public Work() {

	}

	/**
	 * 
	 * @return
	 */
	public String getDescription() {
		return this.description;
	}

	public Go getGo() {
		return go;
	}

	public WorkKey getKey() {
		return null;
	}

	public void setKey(WorkKey workKey) {
		this.workKey = workKey;
	}

	public String getWorkId() {
		return workKey.getName();
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public void setGo(Go go) {
		this.go = go;
	}

	public void setWorkId(String workerId) {
		this.workerId = workerId;
	}

	/**
	 * 
	 * @return
	 */
	public boolean isConcurrentExectionDisallowed() {
		return ClassUtils.isAnnotationPresent(go.getClass(), DisallowConcurrentExecution.class);
	}

	/**
	* <p>
	* Get the instance of <code>Work</code> that will be executed.
	* </p>
	*/
	@SuppressWarnings("unchecked")
	public Class<? extends Work> getWorkClass() {
		return (Class<? extends Work>) go.getClass();
	}

	public void setSts(String stsPause) {

	}

	public String getBaseTaskType() {
		return null;
	}
}
